package com.softserveinc.edu.oms.persistence.entities;

import java.util.Date;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import com.softserveinc.edu.oms.persistence.AbstractEntity;

@Entity
@Table(name = "Orders")
public class Order extends AbstractEntity {
	private Integer id;
	private User customer;
	private User assigne;
	private Double totalPrice;
	private Date deliveryDate;
	private Date orderDate;
	private OrderStatus orderStatus;

	public Order() {
	}

	public Order(final Integer id, final User customer, final User assigne,
			final Double totalPrice, final Date deliveryDate,
			final Date orderDate, final OrderStatus orderStatus) {
		super();
		this.id = id;
		this.customer = customer;
		this.assigne = assigne;
		this.totalPrice = totalPrice;
		this.deliveryDate = deliveryDate;
		this.orderDate = orderDate;
		this.orderStatus = orderStatus;
	}

	@Override
	@Id
	@GeneratedValue
	@Column(name = "ID")
	public Integer getId() {
		return id;
	}

	@Override
	public void setId(final Integer id) {
		this.id = id;
	}

	@ManyToOne(cascade = CascadeType.MERGE)
	@JoinColumn(name = "Customer")
	public User getCustomer() {
		return customer;
	}

	public void setCustomer(final User customer) {
		this.customer = customer;
	}

	@ManyToOne(cascade = CascadeType.MERGE)
	@JoinColumn(name = "Assigne")
	public User getAssigne() {
		return assigne;
	}

	public void setAssigne(final User assigne) {
		this.assigne = assigne;
	}

	@Column(name = "TotalPrice")
	public Double getTotalPrice() {
		return totalPrice;
	}

	public void setTotalPrice(final Double totalPrice) {
		this.totalPrice = totalPrice;
	}

	@Column(name = "DeliveryDate")
	public Date getDeliveryDate() {
		return deliveryDate;
	}

	public void setDeliveryDate(final Date deliveryDate) {
		this.deliveryDate = deliveryDate;
	}

	@Column(name = "OrderDate")
	public Date getOrderDate() {
		return orderDate;
	}

	public void setOrderDate(final Date orderDate) {
		this.orderDate = orderDate;
	}

	@ManyToOne(cascade = CascadeType.MERGE)
	@JoinColumn(name = "OrderStatusRef")
	public OrderStatus getOrderStatus() {
		return orderStatus;
	}

	public void setOrderStatus(final OrderStatus orderStatus) {
		this.orderStatus = orderStatus;
	}

}
